package com.huawei.struts.service.imp;

import java.util.List;

import com.huawei.struts.dao.LjwVillageTDAO;
import com.huawei.struts.exception.SystemException;
import com.huawei.struts.service.IVillageService;
import com.huawei.struts.util.PageBean;
import com.st.model.LjwVillageT;

public class VillageService implements IVillageService {

	private LjwVillageTDAO ljwVillageTDAO;

	public void setLjwVillageTDAO(LjwVillageTDAO ljwVillageTDAO) {
		this.ljwVillageTDAO = ljwVillageTDAO;
	}

	public void addVillage(LjwVillageT village) throws SystemException {
		ljwVillageTDAO.save(village);

	}

	public void delVillage(LjwVillageT village) throws SystemException {
		ljwVillageTDAO.delete(village);

	}

	public LjwVillageT getVillageInfoByid(Integer id) throws SystemException {
		// TODO Auto-generated method stub
		return ljwVillageTDAO.findById(id);
	}

	public PageBean getVillageList(LjwVillageT village, PageBean pageBean) {
		int allRows=ljwVillageTDAO.getAllRowCount(village);//得到记录总数
		PageBean page=pageBean.pagationTemplate(allRows, pageBean.getCurrentPage());//获取分页的全部信息
		List list=ljwVillageTDAO.queryForPage(village, page);//得到结果集
		page.setList(list);
		return page;
	}

	public void modifyVillage(LjwVillageT village) throws SystemException {
		ljwVillageTDAO.merge(village);

	}

}
